//
//  JQFYTicketInfo_infoTableViewCell.m
//  JQFY
//
//  Created by apple on 2017/9/5.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYTicketInfo_infoTableViewCell.h"
#import "JQFYTicketInfoModel.h"

@interface JQFYTicketInfo_infoTableViewCell()

@property (nonatomic ,strong) UIView *containView;

@end

@implementation JQFYTicketInfo_infoTableViewCell

- (void)setModel:(JQFYTicketInfoModel *)model {
    _model = model;
    CGFloat height = 40;
    if (model.isShow) {
        height = 450;
    }
    [self.containView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(height);
    }];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}

-(void) setupUI{
    self.backgroundColor = [UIColor clearColor];
    UIView *containView = [[UIView alloc] init];
    containView.backgroundColor = RGBCOLOR(46, 21, 97);
    containView.layer.cornerRadius = 5;
    containView.layer.edgeAntialiasingMask = YES;
    [self.contentView addSubview:containView];
    self.containView = containView;
    
    [containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.mas_equalTo(10);
        make.top.equalTo(self.containView.mas_bottom).offset(2);
    }];
}

+ (CGFloat)heightForCellWithModel:(JQFYTicketInfoModel *)model {
    CGFloat height = 0;
    height += [UIFont systemFontOfSize:13].lineHeight + 2;
//    height = (height + [UIFont systemFontOfSize:13].lineHeight + 2);
    if (model.isShow) {
        height += 450;
    } else {
        height += 40;
    }
    return height;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
